package 贪心算法;

public class 跳跃算法 {

    public static boolean canJump(int[] nums) {
        int end = nums.length -1;
        while (end > 0){
            boolean flag = false;
            for (int i = 0; i < end; i++) {
                if (i+nums[i]  >= end ) {
                    end = i;
                    flag = true;
                    break;
                }
            }
            if (!flag){
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        int[] nums = {0};
        System.out.println(canJump(nums));
    }
}
